const pkg = require('./package')
// import axios from 'axios'

module.exports = {
  mode: 'universal',
  // mode: 'spa',
  // 配置动态路由
  generate: {
    routes: [
      // '/',
      // '/factory',
    ],
    minify: {
      collapseWhitespace: false
    },
    // routes: function () {
    //   return axios.get('https://my-api/users')
    //   .then((res) => {
    //     console.log(res)
    //     return res.data.map((product) => {
    //       return {
    //         route: '/product/' + product.id,
    //       }
    //     })
    //   })
    // }
  },
  /*
  ** Headers of the page
  */
  head: {
    title: '一呼百应工业品直卖网_【官网】',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: pkg.description },
      { name: 'keywords', content: pkg.keywords },
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },

  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },
  // 二级目录
  router: {
    base: '/mallplus/',
    extendRoutes(routes, resolve) {

    }
  },

  /*
  ** Global CSS
  */

  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '@/plugins/element-ui',
    { src: '~/utils/axios', ssr: true },
    { src: '~/utils/util', ssr: true },
    { src: '~/utils/permission', ssr: true }
  ],
  css: [
    'element-ui/lib/theme-chalk/index.css',
    '~/styles/base.scss'
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
    // '@nuxtjs/style-resources',
    // axios: {
    //   prefix: 'https://www.youboy.com', // baseURL
    // },
  ],
  // styleResources: {
  //   scss: './styles/common/__variable.scss',
  // },
  /*
  ** Axios module configuration
  */
  axios: {
    // See https://github.com/nuxt-community/axios-module#options

  },

  /*
  ** Build configuration
  */
  build: {
    // transpile: [/^element-ui/],
    vendor: ['element-ui'],
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {
    }
  }
}
